/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Ltd.            */
/*                                                                 */
/*  NAME      = activeMQ_boolean_stream_parse2.c                      */
/*  NOTE      =                                                    */
/*  DATE      = 2015/05/21 by geyh                                 */
/*******************************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <CUnit/Basic.h>
#include <CUnit/CUnit.h>

#include "frmem.h"
#include "frcomm.h"
#include "frbyte_buffer.h"
#include "../../src/module/activemq/activemq_common.h"
#include "../../src/module/activemq/activemq_base_type.h"
#include "../../src/module/activemq/activemq_core.h"
#include "apmtest_cunit.h"
#include "../../../src/module/activemq/config.h"

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

int activeMQ_boolean_stream_parse2(Frbyte_Packet *p_st_data);


static void __case1(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    i_ret = activeMQ_boolean_stream_parse2(p_st_data);

    CU_ASSERT_EQUAL(i_ret,-1);
    bytebuff_free(&p_st_data);

    return;

}

static void __case2(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    p_st_data = bytebuff_creat();
    bytebuff_add(p_st_data, (char *)"\x01", 1);

    i_ret = activeMQ_boolean_stream_parse2(p_st_data);

    CU_ASSERT_EQUAL(i_ret,1);
    bytebuff_free(&p_st_data);

    return;

}

static void __case3(void)
{
    Frbyte_Packet *p_st_data = NULL;
    int i_ret = 0;

    p_st_data = bytebuff_creat();
    bytebuff_add(p_st_data, (char *)"\x00", 1);

    i_ret = activeMQ_boolean_stream_parse2(p_st_data);

    CU_ASSERT_EQUAL(i_ret,0);
    bytebuff_free(&p_st_data);

    return;

}


int add_suite_activeMQ_boolean_stream_parse2(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" activeMQ_boolean_stream_parse2()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL ||
        CU_add_test(pSuite, "case2", __case2) == NULL ||
        CU_add_test(pSuite, "case3", __case3) == NULL)
        return FR_FAIL;

    return FR_SUCC;

}

